package com.design.softwaredesign.controller;

import com.design.softwaredesign.front.CategoryInfo;
import com.design.softwaredesign.service.BackCategoryService;
import com.design.softwaredesign.vo.DataVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author :WaiterXiaoYY
 * @description: TODO
 * @data :2020/11/5 20:21
 */
@Api(description = "管理员后台控制层-类型管理控制")
@RestController
@RequestMapping("/web/admin")
public class BackCategoryController {

    @Autowired
    private BackCategoryService backCategoryService;

    @ApiOperation(value = "根据类型状态获取类型")
    @GetMapping("/getcategorybystate/{categoryState}")
    public DataVo getCategoryByState(@PathVariable Integer categoryState) {
        DataVo dataVo = backCategoryService.getCategoryByState(categoryState);
        return dataVo;
    }

    @ApiOperation(value = "根据方向改变类型状态")
    @PostMapping("/updatecategorystate")
    public DataVo updateCategoryState(@RequestBody CategoryInfo categoryInfo) {
        DataVo dataVo = backCategoryService.updateCategoryState(categoryInfo);
        return dataVo;
    }

}
